package com.service.lyxmservice.service.behind;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;

import com.service.lyxmservice.dao.behind.BehindDao;
import com.service.lyxmserviceapi.service.behind.BehindService;

public class BehindServiceImpl implements BehindService{
	@Autowired
	private BehindDao behindDao;
	
	@Override
	public Integer insertArticle(String title, String context, String authorId,
			String moduleId, String description, String imgsrc, String target) {
		if(!ObjectUtils.isEmpty(target)){
			String [] aa = target.split("-");
			String b = "";
			for(String a:aa){
				b = b+a+",";
			}
			if(b.length()>=1){
				target = b.substring(0, b.length()-1);
			}
			
		}
		
		return behindDao.insertArticle(title, context, authorId, moduleId, description, imgsrc, target);
	}

	/**
	 * 新增模块
	 */
	@Override
	public Integer insertModule(String moduleName, String belongModuleId) {
		return behindDao.insertModule(moduleName, belongModuleId);
	}
	
	
	/**
	 * 新增作者
	 */
	@Override
	public Integer insertAuthor(String authorName,String realName,String introduction,String imgsrc) {
		return behindDao.insertAuthor(authorName, realName, introduction, imgsrc);
	}
	
}
